<script>

jQuery(document).ready(function($) {	
			 $( "#dialogModal" ).dialog({
				height: 'auto',
				width: 'auto',
				autoOpen: false,
				show: {
					effect: "blind",
					duration: 500
					
					},
				hide: {
					effect: "blind",
					duration: 500
					},
				modal: true,
				
				});
    //respond to click event on anything with 'overlay' class
			$(".overlay").click(function(event){
				event.preventDefault();
				$('#contentWrap').load($(this).attr("href"));  //load content from href of link
				$('#dialogModal').dialog('option', 'title', $(this).attr("title"));  //make dialog title that of link
				$('#dialogModal').dialog('open');  //open the dialog
				});
				
});
//glo1=0;
/*
$( "#DetailBillForm" ).submit(function( event ) {
//$("#DetailBillForm button").click(function(event) {
	event.preventDefault();
	
	$.ajax({	
			type: "post",
			url:url,
			data:{id:id},
			dataType:"Html",
			cache: false,					
			success:function(result) { 
				//console.log(result);
			 //Bạn nạp data này vào thẻ div
			 $("#hienthi").html(result);
			//return result;

		  } 
		});
	});	
	*/

</script>
<div id="dialogModal">
     <!-- the external content is loaded inside this tag -->
     <div id="contentWrap"></div>
</div>
<style>
		.dv{
		font: 12px sans-serif;
		}
		
.row {
    margin-bottom: 8px;
    overflow: hidden;
}
.row input,.row select {
    border: 1px solid #c0c0c0;
    padding: 3px;
	}
.row label {
    float: left;
    width: 100px;
}
.row textarea {
    border: 1px solid #c0c0c0;
    box-sizing: border-box;
    max-width: 256px;
    min-height: 70px;
    padding: 4px;
    width: 256px;
}
.btn-dialog {
    border-top: 1px solid #c0c0c0;
    margin-top: 10px;
    padding: 10px 2px 0 0;
    text-align: right;
}
.btn-dialog input {
    border: 1px solid #c0c0c0;
    cursor: pointer;
    padding: 3px 10px;
}
.btn-dialog input[type="button"] {
    float: right;
    margin-left: 10px;
}

</style>

		<?php// $hour =  $this->requestAction('/bills/max_hour/1');
		//debug($hour);
?>
	
		<div>
			<label>Kính gửi khách hàng : <?php echo $bill['Reservation']['Guest']['name'];?></label>			
		</div>
		<div style="margin:20px 0">
			<label style="font-weight:bold;font-size:20px">Hóa đơn thanh toán phòng <?php echo $bill['Room']['name'];?></label>
			<label style="float:right;">Mã HĐ:<?php echo $bill['Bill']['id'];?></label>
		</div>
		<div class="row">
			<label>Ngày vào</label>
			<?php echo $bill['Bill']['start_date'];?>
		</div>
		<div class="row">
			<label>Ngày ra</label>
			<?php echo date("Y-m-d H:i:s")?>
		</div>
		<div class="row">
			<label>Tiền phòng</label>
			<div class="row">
				<p style="float:left;">Tiền phòng</p>
				<p style="float:right;">1,000,000 VNĐ</p>
				<div style="border-bottom:1px dashed #ccc; clear:both;"></div>
				<p style="float:left;">Tiền phòng</p>
				<p style="float:right;">1,000,000 VNĐ</p>
				<div style="border-bottom:1px dashed #ccc; clear:both;"></div>
				<p style="float:left;">Tiền phòng</p>
				<p style="float:right;">1,000,000 VNĐ</p>
				<div style="border-bottom:1px dashed #ccc; clear:both;"></div>
			</div>
		</div>
		<div class="row">
			<label>Tiền dịch vụ</label>
			<div class="row">
			<ul class = "dichvu">
				<li>
				<p style="float:left;">Tiền dịch vụ</p>
				<p style="float:right;">1,000,000 VNĐ</p>
				<div style="border-bottom:1px dashed #ccc; clear:both;"></div>
				</li>				
				<li style="display: none">
					<div id="results">
						<div id="content"></div>
					</div>
					
				</li>				
			</ul>
				<?php echo $this->Form->create('DetailBill',array('action'=>'add',$bill['Bill']['id']));?>
				<?php echo $this->Form->input('DetailBill.services_id',array('label'=>false, 'style'=>'max-width:256px;','div'=>false));?> x
				<select name="data[DetailBill][soluong]" id="soluont" style="font-size: 13px;">
					<option selected="" value="1">1</option>
					<option value="2">2</option>
					<option value="3">3</option>
					<option value="4">4</option>
					<option value="5">5</option>
					<option value="6">6</option>
					<option value="7">7</option>
					<option value="8">8</option>
					<option value="9">9</option>
					<option value="10">10</option>
					<option value="0">Khác</option>
					<option value="-1">-1</option>
					<option value="-2">-2</option>
					<option value="-3">-3</option>
					<option value="-4">-4</option>
					<option value="-5">-5</option>
					</select>
<?php
				echo $this->Form->end('Thêm');
				?>
			
				
				
				
			</div>
		</div>
		<?php echo $this->Form->create('Bill',array('controller'=>'bills','action'=>'edit')); ?>
		<div class="row">
			<label>Trả trước</label>
			<?php echo $bill['Bill']['prepay'];?> VNĐ 
			<?php echo $this->Html->link($this->Html->image("icons/add-icon.png", array("alt" => "Brownies",'width'=>12)),array('controller' => 'detailbills','action' => 'add','id' => $bill['Bill']['id'],'comments' => false),array('escape' => false,"class"=>"overlay", "title"=>"Trả trước "));?>
		</div>
		<div class="row">
			<label>Khuyến mại</label>
			<?php echo $this->Form->input('email',array('label'=>false, 'style'=>'max-width:256px;','div'=>false));?>
		</div>
		<div class="row">
			<label>Khoản khác</label>
			<?php echo $this->Form->input('email',array('label'=>false, 'style'=>'max-width:256px;','div'=>false));?>
		</div>
		<div class="row">
			<label>Ghi chú</label>
			<?php echo $this->Form->input('note',array('label'=>false, 'style'=>'max-width:256px;','div'=>false));?>
		</div>
		<div class="row">
			<label>Thanh toán</label>
			<label>Số tiền</label>
		</div>
		<div class="row">
			<label>Chuyển thanh toán</label>
			<label>Số tiền</label>
		</div>
		<div class="btn-dialog">
			<input type="button" value="Save" class="close_addservice">
			<?php 
			echo $this->Js->submit('Checkout', array(  //create 'ajax' save button
				'update' => '#contentWrap','div'=>false  //id of DOM element to update with selector
				));
				/*
			if (false != $saved){ //will only be true if saved OK in controller from ajax save above
				echo "<script>
					$('#success').dialog('open');  //close containing dialog 
				</script>";
				}
				*/
			echo $this->Form->end();
			echo $this->Js->writeBuffer();
			?>

			<input type="button" value="Cancel" class="close_addservice">
		</div>
		
